#include "fwrite.hpp"

namespace fur
{
   FWrite::FWrite(std::ostream &outfile)
      :os(outfile)
   {
      writtensize = 0;
   }
   
   FWrite::~FWrite()
   {
   }

   void FWrite::write(const uint8_t *data, size_t size)
   {
      os.write(reinterpret_cast<const char*>(data), size);
      writtensize += size;
      datacrc.process_bytes(data, size);
   }
   
   uint32_t FWrite::get_crc()
   {
      return datacrc.checksum();
   }

   uint64_t FWrite::get_writtensize()
   {
      return writtensize;
   }

} // end of namespace fur
